home *** CD-ROM | disk | FTP | other *** search
/ Nebula 2 / Nebula Two.iso / NextAnswers / 1423_stray_pixels_and_setstrokeadjust.rtf < prev    next >
Text File  |  1993-11-08  |  3KB  |  40 lines

  1. {\rtf0\ansi{\fonttbl\f0\fnil Times-Roman;\f2\fmodern Courier;\f1\fmodern Ohlfs;}
  2. \paperw10640
  3. \paperh8160
  4. \margl120
  5. \margr120
  6. {\colortbl;\red0\green0\blue0;}
  7. \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\f0\b0\i0\ulnone\fs28\fc0\cf0 Q.  If I fill a circle using PostScript, then stroke it with a different color using the default linewidth of 1, not all of the pixels get covered at the edges.  I thought a linewidth of 0 could cause this problem, but a linewidth of 1 shouldn't!  Drawing applications such as Draw.app demonstrate the same problem:  Create a circle filled with black and outlined with white, using a line thickness of 1.  You'll notice stray black pixels around the edges.  What's going on here? How can this problem be avoided?\
  8. \
  9. A. PostScript scanning should normally cause any non-zero linewidth to eliminate the stray pixels in the above scenarios.  However, PostScript also has a "stroke adjustment" feature which, when turned on, tries to create lines of uniform thickness on low-resolution output devices (such as displays). This causes the above problems to appear—a line of width 1 drawn on a path might fail to fully cover the pixels on the edges of a fill done on the same path.  By default, stroke adjustment is enabled for displays and disabled for printers.\
  10. \
  11. Given this, developers of drawing and other applications should look into turning off stroke adjustment when displaying graphic objects created/manipulated by users in documents.  This can be accomplished with\
  12. \
  13.  
  14. \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\f2\fs24\fc1\cf1     false setstrokeadjust\
  15.  
  16. \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\f0\fs28\fc0\cf0 \
  17. The previous strokeadjust value should be restored once the graphics are drawn; this can be done via gsave/grestore or by explicitly remembering the previous value:\
  18. \
  19.  
  20. \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\f2\fs24\fc1\cf1     currentstrokeadjust\
  21.     false setstrokeadjust\
  22.  
  23. \i     ... drawing code ...\
  24.  
  25. \i0     setstrokeadjust\
  26.  
  27. \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\f0\fs28\fc0\cf0 \
  28. You can read more about the 
  29. \f2\fs24\fc1\cf1 setstrokeadjust 
  30. \f0\fs28 and
  31. \f2\fs24  currentstrokeadjust
  32. \f0\fs28  operators in section 6.5 of the PostScript Language Reference Manual 2nd edition (the level 2 red book).\
  33. \
  34.  
  35. \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\fc1\cf1 QA871\
  36. \
  37. Valid for 2.0, 3.0\
  38. \
  39.  
  40.